/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package tetrisdamage;

import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;
import java.util.Properties;

/**
 *
 * @author Zheltoukhov
 */
public class ConfigManager {
//

    private Integer WINDOW_WIDTH;
    private Integer WINDOW_HEIGHT;
    private Boolean IS_FULLSCREEN;

    ConfigManager() throws IOException {
        Properties prop = new Properties();
        String propFileName = "config.properties";

        InputStream inputStream = getClass().getClassLoader().getResourceAsStream(propFileName);

        if (inputStream != null) {
            prop.load(inputStream);
        } else {
            throw new FileNotFoundException("property file '" + propFileName + "' not found in the classpath");
        }
        setWindowWidth(Integer.parseInt(prop.getProperty("width")));
        setWindowHeight(Integer.parseInt(prop.getProperty("height")));
        setIsFullscreen(Boolean.valueOf(prop.getProperty("fullscreen")));

    }

    public Integer getWindowWidth() {
        return WINDOW_WIDTH;
    }

    public void setWindowWidth(Integer windowWidth) {
        this.WINDOW_WIDTH = windowWidth;
    }

    public Integer getWindowHeight() {
        return WINDOW_HEIGHT;
    }

    public void setWindowHeight(Integer windowHeight) {
        this.WINDOW_HEIGHT = windowHeight;
    }

    public Boolean isFullscreen() {
        return IS_FULLSCREEN;
    }

    public void setIsFullscreen(Boolean isFullscreen) {
        this.IS_FULLSCREEN = isFullscreen;
    }

}
